---
title: "Titanic"
output:
flexdashboard::flex_dashboard:
orientation: columns
vertical_layout: fill
logo: logo.png
source_code: embed
social: menu
---
```{r setup, include=FALSE}
library(flexdashboard)
library(tidyverse)
library(plotly)
library(knitr)
library(DT)
library(rsconnect)
# Create a ggplot object
library(plotly)
df <- read_csv('diabetes.csv')
df$preg <- case_when(df$Pregnancies >= 1 ~ "Has been Pregnant",TRUE ~"Never been pregnant")
```
{.sidebar}
=======================================================================
### 1. Titanic
The sinking of the Titanic is one of the most infamous shipwrecks in history. While there was some element of luck involved in surviving, it seems some groups of people were more likely to survive than others.
### 2. Flexdashboard and Plotly
This interactive uses `flexdashboard` and `plotly` to visualize the data.
Main Tab 1
=======================================================================
Column {data-width=500, .tabset}
-----------------------------------------------------------------------
### Column Tab 1
```{r}
datatable(df, options = list(
pageLength = 25
))
```
Column {data-width=500}
-----------------------------------------------------------------------
```{r}
df %>% ggplot(aes(x=Age,y=Pregnancies))+geom_point()
```
Main Tab 2
=======================================================================
Column {data-width=500}
-----------------------------------------------------------------------
#### 3. Example
```{r, echo=TRUE, eval=TRUE}
p <-df %>% ggplot(aes(x=preg)) + geom_bar()
ggplotly(p)
```
Column {data-width=500}
-----------------------------------------------------------------------
### Row 1
```{r}
p <- df %>% ggplot(aes(x=Age, y = Glucose)) + geom_point()
ggplotly(p)
```
Main Tab 3
=======================================================================
```{r}
df %>% ggplot(aes(x = SkinThickness, y = BloodPressure))+geom_point()
```